// import http from 'utilMethods/http'
// const request = 'http://wechat.wsn2019.club'
// const api = 'https://api.weixin.qq.com'

// export const getWxToken = () => 
//   ajax(`${api}/cgi-bin/token`, {
//     grant_type: 'client_credential',
//     appid: 'wx1e227dedfc1d5210',
//     secret: 'ba660c7f72c7b7c7df3a2c5aec282008'
//   })
// const randomThing = common.randomString()
// const access_token = '31_ArjJqFIiJDszm0ZSCeCgdhwxMw9U1JOFw9lN1z1JhD2kv-ZWaZ5IwTGVfDnr1bLTM1eAMkkm_Fdtb0L2bAK_SPiPG0rRPUUlpaMIslk7tLnehtP6C-Bfar2OC7YTWBdADAMPU'
// const jsapi_ticket = 'kgt8ON7yVITDhtdwci0qeX-DYcdsmE7GI0Sk31qYfEC-3fxd4_nZMZhFegfMYooiFaZjG2f_VLRqL6juwp-ihA'


// const nonceStr = randomThing.randomStr
// const timestamp = randomThing.timestamp
// const url = window.location.href
// const string1 = 'jsapi_ticket=' + jsapi_ticket + '&' +
//                 'noncestr=' + nonceStr + '&' +
//                 'timestamp=' + timestamp + '&' +
//                 'url=' + url
// const signature = hex_sha1(string1)

// export const getAccessToken = () => 
//   ajax(`/wxconfig/cgi-bin/token`, {
//     grant_type: 'client_credential',
//     appid: 'appid',
//     secret: 'appsecret'
//   })

// export const getJsApiTicket = (access_token) =>
//   ajax(`/wxconfig/cgi-bin/ticket/getticket`, {
//     access_token: access_token,
//     type: 'jsapi'
//   })

// export const getWxConfigParams = url => 
//   http.get(`/wx/sign`, {url: url})

// export const getUrlOfScanOfGroup = params => 
//   http.get(`/wx/scan`, params)

// export const getScanOfGroup = (urlOfScanOfGroup) => 
//   http.get(urlOfScanOfGroup)

// // 将短地址还原为长地址的接口 （用不到）
// export const getLongUrlFromShort = shortUrl => 
//   ajax(`/url`, {url: shortUrl}, 'GET')
import http from 'utilMethods/http'
const request = 'http://wechat.wsn2019.club'
const wx = {
  // 获取调用微信接口的config参数
  getWxConfigParams (currentUrl) {
    return http.get(`${request}/sign`, {url: currentUrl})
  },

  // pay-controller
  postCreateOrder (params) {
    return http.post(`${request}/pay/createOrder`, params);
  },

  // 查询某人未支付罚款
  postQueryFine ({openid: openId}) {
    return http.post(`${request}/pay/queryFine`, {openid: openId});
  },

  // 查询某人是否有罚款订单
  postUserOrder ({openid: openId}) {
    return http.post(`${request}/pay/UserOrder`, {openid: openId});
  }
}

export default wx